
{{ 'section-multicolumn.css' | asset_url | stylesheet_tag }}
<link rel="stylesheet" href="{{ 'component-slider.css' | asset_url }}" media="print" onload="this.media='all'">
<noscript>{{ 'component-slider.css' | asset_url | stylesheet_tag }}</noscript>

<div class="multicolumn-home">
    <div class="multicolumn background-{{ section.settings.background_style }}{% if section.settings.title == blank %} no-heading{% endif %}">
        <div class="page-width">
          <div class="title-wrapper-with-link title-wrapper--self-padded-mobile{% if section.settings.title == blank %} title-wrapper-with-link--no-heading{% endif %}">
            <h2 class="title">
              {{ section.settings.title | escape }}
              {%- if section.settings.title_icon != blank %}
                 <span>{{ section.settings.title_icon }}</span>
              {%- endif -%}
            </h2>
            {%- if section.settings.button_label != blank and section.settings.swipe_on_mobile -%}
              <a href="{{ section.settings.button_link }}" class="link underlined-link large-up-hide">{{ section.settings.button_label | escape }}</a>
            {%- endif -%}
          </div>
          <div class="swiper-father">
          <slider-component class="slider-mobile-gutter multicolumn-home-swiper swiper-container">
        
            <ul class="swiper-wrapper multicolumn-list grid"
              id="Slider-{{ section.id }}"
              role="list"
            >
              {%- liquid
                assign highest_ratio = 0
                for block in section.blocks
                  if block.settings.image.aspect_ratio > highest_ratio
                    assign highest_ratio = block.settings.image.aspect_ratio
                  endif
                endfor
              -%}
              {%- for block in section.blocks -%}
                <li class="swiper-slide multicolumn-list__item" {{ block.shopify_attributes }}>
                  <a target="_blank" class="video-button"{% if block.settings.button_link == blank %} aria-disabled="true"  role="link"{% else %} href="{{ block.settings.button_link }}"{% endif %}>
                  <div class="multicolumn-card">
                    {%- if block.settings.image != blank -%}
                      {% if section.settings.image_ratio == 'adapt' or section.settings.image_ratio == 'circle' %}
                        {% assign spaced_image = true %}
                      {% endif %}
                      <div class="multicolumn-card__image-wrapper multicolumn-card__image-wrapper--{{ section.settings.image_width }}-width{% if section.settings.image_width != 'full' or spaced_image %} multicolumn-card-spacing{% endif %}">
                        <div class="media--transparent media--{{ section.settings.image_ratio }}">
                          <img
                            srcset="{%- if block.settings.image.width >= 88 -%}{{ block.settings.image | img_url: '88x' }} 88w,{%- endif -%}
                            {%- if block.settings.image.width >= 195 -%}{{ block.settings.image | img_url: '195x' }} 185w,{%- endif -%}
                            {%- if block.settings.image.width >= 275 -%}{{ block.settings.image | img_url: '275x' }} 275w,{%- endif -%}
                              {%- if block.settings.image.width >= 550 -%}{{ block.settings.image | img_url: '550x' }} 550w,{%- endif -%}
                              {%- if block.settings.image.width >= 710 -%}{{ block.settings.image | img_url: '710x' }} 710w,{%- endif -%}
                              {%- if block.settings.image.width >= 1420 -%}{{ block.settings.image | img_url: '1420x' }} 1420w,{%- endif -%}"
                            data-src="{{ block.settings.image | img_url: '550x' }}"
                            sizes="(min-width: 990px) {% if section.blocks.size <= 2 %}710px{% else %}550px{% endif %},
                              (min-width: 750px) {% if section.blocks.size == 1 %}710px{% else %}550px{% endif %},
                              calc(100vw - 30px)"
                            alt="{{ block.settings.image.alt }}"
                            height="{{ block.settings.image.height }}"
                            width="{{ block.settings.image.width }}"
                            loading="lazy"
                            class="lazyload"
                          >
                        </div>
                      </div>
                      {%- if block.settings.media_des != blank -%}
                            <div class="media_des">{{ block.settings.media_des }}</div>
                      {%- endif -%}

                    {%- endif -%}
                    <div class="multicolumn-card__info">
                      {%- if block.settings.star_rating != blank -%}
                      <div class="star_rating">
                        {{ block.settings.star_rating }}
                      </div>
                      {%- endif-%}

                        {%- if block.settings.button_label != blank -%}
                        <div class="text-button">
                          <a target="_blank" class="video-button"{% if block.settings.button_link == blank %} aria-disabled="true"  role="link"{% else %} href="{{ block.settings.button_link }}"{% endif %}>
                           {{ block.settings.button_label | escape }}
                         </a>
                       </div>
                    {%- endif-%}
                     
                      {%- if block.settings.text != blank -%}
                        <div class="rte">{{ block.settings.text }}</div>
                      {%- endif -%}
                     
                      {%- if block.settings.title != blank -%}
                      <div class="time">{{ block.settings.title | escape }}</div>
                    {%- endif -%}

                    </div>
                  </div>
                </a>
                </li>
              {%- endfor -%}
            </ul>
     
    
          </slider-component>
          
            <!-- Add Pagination -->
           <div class="swiper-pagination m_home"></div>   
            <!-- Add Arrows -->
        <div class="swiper-button-next m_home">{% render 'swiper-next' %}</div>
        <div class="swiper-button-prev m_home">{% render 'swiper-prev' %}</div>

          </div>
        </div>
      </div>
</div>


<script>
    var swiper = new Swiper('.multicolumn-home-swiper', {
      spaceBetween: 33,
      observer:true,//修改swiper自己或子元素时，自动初始化swiper
      observeParents:true,//修改swiper的父元素时，自动初始化swiper
      loop:true,
      pagination: {
        el: '.swiper-pagination.m_home',
        dynamicBullets: true,     
        dynamicMainBullets: 6
      },
      navigation: {
          nextEl: '.swiper-button-next.m_home',
          prevEl: '.swiper-button-prev.m_home',
        },
      breakpoints: {
        375: {
          slidesPerView: 1,
          spaceBetween: 26,
        },
        640: {
          slidesPerView: 1,
          spaceBetween: 26,
        },
        768: {
          slidesPerView: 2,
          spaceBetween:26,
        },
        769: {
          slidesPerView: 3,
          spaceBetween: 32,
        },
        1024: {
          slidesPerView: 3,
          spaceBetween: 40,
        },
        1280: {
          slidesPerView: 4,
          spaceBetween: 20,
        },
        1440: {
          slidesPerView: 4,
          spaceBetween: 32,
        }
      }
    });
</script>

{% schema %}
{
  "name": "Media assessment",
  "class": "spaced-section spaced-section--full-width",
  "tag": "section",
  "settings": [
    {
      "type": "text",
      "id": "title",
      "default": "Multicolumn",
      "label": "t:sections.multicolumn.settings.title.label"
    },
    {
      "type": "html",
      "id": "title_icon",
      "default": "html",
      "label": "Header icon"
    },
    {
      "type": "select",
      "id": "image_width",
      "options": [
        {
          "value": "third",
          "label": "t:sections.multicolumn.settings.image_width.options__1.label"
        },
        {
          "value": "half",
          "label": "t:sections.multicolumn.settings.image_width.options__2.label"
        },
        {
          "value": "full",
          "label": "t:sections.multicolumn.settings.image_width.options__3.label"
        }
      ],
      "default": "full",
      "label": "t:sections.multicolumn.settings.image_width.label"
    },
    {
      "type": "select",
      "id": "image_ratio",
      "options": [
        {
          "value": "adapt",
          "label": "t:sections.multicolumn.settings.image_ratio.options__1.label"
        },
        {
          "value": "portrait",
          "label": "t:sections.multicolumn.settings.image_ratio.options__2.label"
        },
        {
          "value": "square",
          "label": "t:sections.multicolumn.settings.image_ratio.options__3.label"
        },
        {
          "value": "circle",
          "label": "t:sections.multicolumn.settings.image_ratio.options__4.label"
        }
      ],
      "default": "adapt",
      "label": "t:sections.multicolumn.settings.image_ratio.label"
    },
    {
      "type": "select",
      "id": "column_alignment",
      "options": [
        {
          "value": "left",
          "label": "t:sections.multicolumn.settings.column_alignment.options__1.label"
        },
        {
          "value": "center",
          "label": "t:sections.multicolumn.settings.column_alignment.options__2.label"
        }
      ],
      "default": "left",
      "label": "t:sections.multicolumn.settings.column_alignment.label"
    },
    {
      "type": "select",
      "id": "background_style",
      "options": [
        {
          "value": "none",
          "label": "t:sections.multicolumn.settings.background_style.options__1.label"
        },
        {
          "value": "primary",
          "label": "t:sections.multicolumn.settings.background_style.options__2.label"
        },
        {
          "value": "secondary",
          "label": "t:sections.multicolumn.settings.background_style.options__3.label"
        }
      ],
      "default": "primary",
      "label": "t:sections.multicolumn.settings.background_style.label"
    },
    {
      "type": "text",
      "id": "button_label",
      "default": "Button label",
      "label": "t:sections.multicolumn.settings.button_label.label"
    },
    {
      "type": "url",
      "id": "button_link",
      "label": "t:sections.multicolumn.settings.button_link.label"
    },
    {
      "type": "checkbox",
      "id": "swipe_on_mobile",
      "default": false,
      "label": "t:sections.multicolumn.settings.swipe_on_mobile.label"
    }
  ],
  "blocks": [
    {
      "type": "column",
      "name": "t:sections.multicolumn.blocks.column.name",
      "settings": [
        {
          "type": "image_picker",
          "id": "image",
          "label": "t:sections.multicolumn.blocks.column.settings.image.label"
        },
        {
          "type": "text",
          "id": "media_des",
          "label": "Media des"
        },
        {
          "type": "html",
          "id": "star_rating",
          "label": "Star rating"
        },
        {
            "type": "text",
            "id": "button_label",
            "default": "Button label",
            "label": "Button label"
          },
          {
            "type": "url",
            "id": "button_link",
            "label": "button_link"
          },
        {
          "type": "richtext",
          "id": "text",
          "default": "<p>Pair text with an image to focus on your chosen product, collection, or blog post. Add details on availability, style, or even provide a review.</p>",
          "label": "t:sections.multicolumn.blocks.column.settings.text.label"
        },
        {
          "type": "text",
          "id": "title",
          "default": "time",
          "label": "Time"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "Media assessment",
      "blocks": [
        {
          "type": "column"
        },
        {
          "type": "column"
        },
        {
          "type": "column"
        }
      ]
    }
  ]
}
{% endschema %}
